package com.example.spareparts.repository;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.*;
import java.util.List;
import com.example.spareparts.entity.InventoryReports;

@Mapper
public interface InventoryReportsRepository {
    @Select("SELECT * FROM InventoryReports")
    List<InventoryReports> findAllInventoryReports();
    @Insert("INSERT INTO InventoryReports (spare_part_id, turnover_rate, occupied_funds, date) VALUES (#{sparepartid}, #{turnoverRate}, #{occupiedFunds}, #{date})")
    @Options(useGeneratedKeys = true, keyProperty = "reportid")
    void insertInventoryReports(InventoryReports inventoryReports);
    @Update("UPDATE InventoryReports SET report_id= #{reportid}, spare_part_id= #{sparepartid}, turnover_rate= #{turnoverRate}, occupied_funds= #{occupiedFunds}, date= #{date} WHERE report_id= #{reportid}")
    void updateInventoryReports(InventoryReports inventoryReports);
    @Delete("DELETE FROM InventoryReports WHERE report_id= #{reportid}")
    void deleteInventoryReports(Long reportid);
    @Select("SELECT * FROM InventoryReports WHERE report_id= #{reportid}")
    InventoryReports findInventoryReportsById(Long reportid);
    @Select("SELECT * FROM InventoryReports WHERE spare_part_id= #{sparepartid}")
    List<InventoryReports> findInventoryReportsBySparePartId(Long sparepartid);


}
